package com.gaoxk;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;

import java.net.UnknownHostException;

//加上exclude= {DataSourceAutoConfiguration.class}就可以启动的时候不需要连接数据库
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
        //(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class },
//scanBasePackages="com.gaoxk.cxf.service.dao")
@ServletComponentScan
@MapperScan(basePackages = { "com.gaoxk.cxf.service.dao" }, sqlSessionFactoryRef = "sqlSessionFactory")
//@ServletComponent
//@ServletComponentScan(basePackages = {"com.gaoxk.distributeReq.ChannelFilter"})
//此注解能保证@WebFilter(urlPatterns = "/BONDService/*")这个urlPatterns生效
public class MyApplication implements CommandLineRunner {

    //static String address = "http://127.0.0.1:8687/ceshifilter/EsbWebService/Maininterface";

    private final static Logger logger = LoggerFactory.getLogger(MyApplication.class);
    public static void main(String[] args) throws UnknownHostException {


        SpringApplication.run(MyApplication.class, args);
        logger.info(MyApplication.class.getSimpleName() + " is success!");


    }

    @Override
    public void run(String... args) throws Exception {

//        AnnotationConfigApplicationContext applicationContext
//                = new AnnotationConfigApplicationContext(MyApplication.class);
//        DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) applicationContext.getBeanFactory();
//        GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
////        Object abc = Class.forName("com.gaoxk.cxf.service.s30064000001.ESBServerSoapEndpointImpl");
////        EndpointImpl endpoint = new EndpointImpl(springBus(), abc);
////        endpoint.publish("/test2");
//        SpringBus bus = new SpringBus();
//        beanDefinition.setBeanClass(bus.getClass());
//        beanFactory.registerBeanDefinition(Bus.DEFAULT_BUS_ID, beanDefinition);



    }

}
